#pragma once

#include <stddef.h>

class CCRC32{
public:
    ~CCRC32();
    static CCRC32* GetInstance(){
        if(m_instance == NULL)
		{
			//锁
			if(m_instance == NULL)
			{				
				m_instance = new CCRC32();
				static CGarhuishou cl; 
			}
			//放锁
		}
		return m_instance;
    }

	class CGarhuishou 
	{
	public:				
		~CGarhuishou()
		{
			if (CCRC32::m_instance)
			{						
				delete CCRC32::m_instance;
				CCRC32::m_instance = NULL;				
			}
		}
	};

	void  Init_CRC32_Table();
	unsigned int Reflect(unsigned int ref, char ch);
	int   Get_CRC(unsigned char* buffer, unsigned int dwSize);

	unsigned int crc32_table[256];// 保存预先生成的查找表

private:
    CCRC32();
    static CCRC32 *m_instance;// 单例对象
};